package com.xcdh.learn.controller;

import com.xcdh.domain.vo.R;
import com.xcdh.learn.service.impl.OssService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

@RestController
@RequestMapping("/oss")
public class UploadController {

    @Autowired
    private OssService ossService ;

    @PostMapping("/uploadImage")
    public R uploadImage(MultipartFile file){
        return ossService.uploadImage(file) ;
    }
    @PostMapping("/delete")
    public R delete(String fileName){
        return ossService.delete(fileName) ;
    }

    @DeleteMapping("/deleteImages")
    public R deleteIMages(@RequestBody List<String> keys){
        return ossService.batchDelete(keys) ;
    }
}
